package com.ihr360.expr.function.excel;


import com.ihr360.expr.ExprDouble;
import com.ihr360.expr.ExprException;
import com.ihr360.expr.context.IEvaluationContext;
import com.ihr360.expr.core.AbstractFunction;
import com.ihr360.expr.core.Expr;
import com.ihr360.expr.utils.Maths;


public class ROUND extends AbstractFunction
{
    @Override
    public Expr evaluate(IEvaluationContext context, Expr[] args)
            throws ExprException {
        assertArgCount(args, 2);
        double num = asDouble(context, args[0], true);
        int dps = asInteger(context, args[1], true);
        return new ExprDouble(Maths.round(num, dps));
    }
}
